#@adminLayout() 

#define main() 

#set(isAdd = banji == null ? true :false, isEdit = !isAdd)

<div class="jfa-header-box" id="jfa-header-box">
	<div class="jfa-crumbs" id="jfa-crumbs">班级管理 / #(isAdd ? "创建" :
		"修改")</div>
	<div class="jfa-search-box"></div>
	#include("/_view/_admin/common/_header_right.html")
</div>


<div class="jfa-content-box" id="jfa-content-box">
	<div class="jfa-content" id="jfa-content">
		<form class="clearfix margin-top-25" id="myArticleForm"
			action="/admin/banji/#(isAdd ? 'save' : 'update')" method="post">

			#if (isEdit) <input type="hidden" name="banji.id" value="#(banji.id)" />
			#end

			<div class="form-group margin-bottom-20">
				<label>班级名称</label> <input type="text" class="form-control"
					name="banji.clname" value="#(banji.clname??)" placeholder="班级唯一标识" />
			</div>

			<div class="form-group margin-bottom-20">
				<label>所属学院</label> <select class="form-control" name="banji.coid"
					class="related-user-name">
					<option></option> #for(x : collegeList)

					<option value="#(x.id)" #if(x.id== banji.coid??) selected #end>#(x.coname)</option>

					#end
				</select>
			</div>

			<div class="pull-right margin-bottom-20">
				<input class="btn btn-primary" type="submit" value="提交" />
			</div>
		</form>

	</div>
	<!-- END OF jfa-content -->
</div>
<!-- END OF jfa-content-box -->

<style type="text/css">
.jfa-content label {
	line-height: 1;
	vertical-align: baseline;
	color: #23527c;
	font-size: 20px;
	font-weight: normal;
	margin-bottom: 8px;;
}
</style>

<script type="text/javascript">
	$(document).ready(function() {
		$("#myArticleForm").ajaxForm({
			dataType: "json"
			, beforeSubmit: function(formData, jqForm, options) {}
			, success: function(ret) {
				if (ret.state == "ok") {
					location.href = "/admin/banji?p=#(p ?? 1)";
				} else {
					showFailMsg(ret.msg);
				}
			}
			, error: function(ret) {alert(ret.statusText);}
			, complete: function(ret) {} 	      // 无论是 success 还是 error，最终都会被回调
		});
	});
</script>

#end
